<?php

namespace app\controllers;

use yii\web\Controller;
use app\models\Pr_field;

class UploadProjectController extends Controller
{
    //禁用原有布局
    public $layout="main2";
    //显示
    public function actionShow()
    {

        RegisterController::prepare();
        $fields = $this->getField();

        return $this->render('upload-project',[
            'fields' => $fields
            ]);
    }
    //项目类型数据
    public function getField()
    {
        $query = Pr_field::find()
        ->orderBy('field_id')
        ->all();
        
        return $query;
    }
    //上传项目
    /*
    public function actionUpload()
    {
        $request = Yii:$app->request;
        $title = $request->post("title");
        $avatar = $request->post("avatar");
        $description = $request->post("dexcription");

        $project = new Pr_project();
        $project->title = $title;
        $project->avatar = $avatar;
        $project->description = $description;
        
        if($project->save() > 0)
        {
            return $this->render('homePage',['project' => $project]);
        }
        else
        {
            return $this->render('error');
        }
    }*/
}
